<template>
  <layout>
    <!-- 查看文件上传内容 -->
    <!-- 顶部操作 -->
    <section slot="search">
      <custom-form
        ref="search-form"
        class="search-form"
        v-model="tableSearch"
        layout="inline"
        mode="search"
        :FormList="searchColumns"
      >
        <a-button
          class="action-button"
          type="primary"
          @click="search()"
        >搜索</a-button>
        
      </custom-form>
    </section>

    <!-- 产品列表 -->
    <a-table
      :dataSource="tableData"
      :columns="tableColumns"
      :rowKey="record => record.member_id"
      :customRow="customTableRow"
      :pagination="false"
      size='small'
      :scroll="{
        x: '100%',
      }"
      bordered
    >
      <!-- 按钮区 -->
      
    </a-table>

    <a-pagination
      slot="paging"
      :pageSizeOptions="pageSizes"
      :total="total"
      :show-total="showTotal"
      showSizeChanger
      :pageSize="pageSize"
      v-model="currentPage"
      @showSizeChange="changePageSize"
      @change="changePage"
    >
    </a-pagination>
  </layout>
</template>

<script lang="ts">
import { Mixins, Component, Watch, Vue, Prop } from 'vue-property-decorator'
import EventsMixin from '@/mixin/events'
import { TableMixin, AuthMixin } from '@/mixin'

import { TableLayout } from '@/layouts'
import CustomForm from '@/components/src/Form'
import { monitorServices } from '@/common/services/monitor'


@Component({
  components: {
    Layout: TableLayout,
    CustomForm,
  }
})
export default class AdminList extends Mixins(
  EventsMixin,
  TableMixin,
  AuthMixin
) {

  @Prop({
    type: String
  })
  public currentAreaId!: string

  @Prop({
    type: String
  })
  public type!: string

  public commonParams = {
    s_a_id: ''
  }

  // 产品列表搜索条件
  public tableSearch = {
    type: 'member'
  }

  // 自定义mode
  public customMode = 'search'

  public columns: ITable.IColumn[] = [
    {
      title: '文件名称',
      dataIndex: 'file_nam',
      key: 'file_nam',
      width: 360
    },
    {
      title: '使用项目',
      dataIndex: 'task_nam',
      key: 'task_nam',
      width: 260
    },
    {
      title: '上传类型',
      dataIndex: 'type',
      key: 'type',
      width: 360,
      form: {
        type: 'a-select',
        placeholder: '请选择上传类型',
        isShowQuery: true,
        dict: [
          {
            label: '农户',
            value: 'member'
          },
          {
            label: '农户耕地',
            value: 'field'
          },
          {
            label: '大户',
            value: 'big_member'
          },
          {
            label: '一次补贴',
            value: 'crop'
          },
          {
            label: '银行回单',
            value: 'bank'
          }
        ]
      }
    },
    {
      title: '上传人',
      dataIndex: 'usr_nickname',
      key: 'usr_nickname',
      width: 120
    },
    {
      title: '上传时间',
      dataIndex: 'i_time',
      key: 'i_time',
      width: 140
    },
    {
      title: '处理状态',
      dataIndex: 'status',
      key: 'status',
      width: 120
    }
  ]

  public tableApi = {
    list: monitorServices.getUploadList
  }

  public mounted() {
    this.commonParams.s_a_id = this.currentAreaId
    this.getData()
    // this.tableData = this.execlData || []
  }

  public async getData() {
    const res = await this.getTableList()
    // this.tableData = []
  }
}
</script>

<style scoped lang="less">
.action-button {
  margin: 0px 10px 0px 10px;
}
.upload-button {
  position: relative;
  input {
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    z-index: 2;
    opacity: 0;
  }
}
.form-item-class {
  margin-bottom: 0px;
}
.img-box {
  width: 100px;
  height: 100px;
  margin: 10px;
}
.item-blue {
  color: #1989fa;
}
</style>
